package se.ramfelt.psn.web;

/**
 * Credentials that is read during start of tests. Now the test cases doesnt
 * have to include the real psn name and password. To use with maven run: 'mvn
 * test -DargLine="-Dpsn.username=name -Dpsn.password=pwd"'
 */
public class PlaystationNetworkCredentials {

    private static final String PSN_USERNAME = "psn.username";
    private static final String PSN_PASSWORD = "psn.password";

    private static String username = "";
    private static String password = "";

    static {
        if (System.getProperties().containsKey(PSN_USERNAME)) {
            username = System.getProperties().getProperty(PSN_USERNAME);
        }
        if (System.getProperties().containsKey(PSN_PASSWORD)) {
            password = System.getProperties().getProperty(PSN_PASSWORD);
        }
    }

    public static boolean isSet() {
        return !(username.isEmpty() && password.isEmpty());
    }

    public static String getUsername() {
        return username;
    }

    public static String getPassword() {
        return password;
    }
}
